<script type="text/javascript">
    RED.nodes.registerType('start-message', {
        category: 'zeebe',
        color: '#C0DEED',
        defaults: {
            name: { value: '' },
            zeebe: { required: true, type: 'zeebe' },
        },
        inputs: 1,
        outputs: 0,
        icon: 'zeebe.png',
        label: function () {
            return this.name || 'start message';
        },
        paletteLabel: 'start message',
    });
</script>

<script type="text/x-red" data-template-name="start-message">
    <div class="form-row">
        <label for="node-input-name"><i class="icon-tag"></i> Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
    <div class="form-row">
        <label for="node-input-zeebe"><i class="fa fa-server"></i> Zeebe Broker</label>
        <input type="text" id="node-input-zeebe" placeholder="Zeebe Broker" />
    </div>
</script>

<script type="text/x-red" data-help-name="start-message">
    <p>When a Node-RED message is received at the input, this node publishes a start message to Zeebe.</p>

    <h3>Inputs</h3>
    <dl class="message-properties">
        <dt>payload <span class="property-type">object</span></dt>
        <dd>Payload object containing properties for sending a message event to zeebe.</dd>

        <dt>payload.name <span class="property-type">string</span></dt>
        <dd>The name of the message.</dd>

        <dt class="optional">payload.variables <span class="property-type">object</span></dt>
        <dd>The message variables as a JSON object.</dd>

        <dt class="optional">payload.timeToLive <span class="property-type">number</span></dt>
        <dd>How long the message should be buffered on the broker, in milliseconds.</dd>
    </dl>

    <h3>References</h3>
    <ul>
        <li>Camunda Cloud Docs: <a href="https://docs.camunda.io/docs/reference/bpmn-workflows/message-events/message-events/">Message Events</a></li>
        <li>zeebe-node docs: <a href="https://www.npmjs.com/package/zeebe-node#publish-a-start-message">publishStartMessage</a></li>
    </ul>
</script>
